/*
 * Copyright (c) 2020-2021, SERI Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-10-29     Lyons        first version
 */

#include "__def.h"

#include "rtthread.h"
#include "timer.h"
#include "xprintf.h"

int main()
{
    xprintf("hello, yu-heng.\n");

    timer_init(TIM1, CPU_FREQ_MHZ-1, (1000/RT_TICK_PER_SECOND)*1000); // tick = 1ms
    timer_control(TIM1, TIM_EN);

    while (1) {
        rt_thread_mdelay(1000);
    }

    return 0;
}

int echo(int argc, char *argv[])
{
    if ( argc >= 2 )
    {
        xprintf("%s\n", argv[1]);
    } else {
        xprintf("echo is on.\n");
    }

    return 0;
}
MSH_CMD_EXPORT(echo, displays messages);

void timer1_handler(void)
{
    extern void rt_os_tick_callback(void);
    rt_os_tick_callback();
}
